<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%article_cate3}}".
 *
 * @property integer $id
 * @property string $name
 * @property integer $parent_cate
 * @property integer $status
 * @property integer $weight
 * @property string $res1
 * @property string $res2
 * @property string $res3
 */
class ArticleCate3 extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%article_cate3}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'parent_cate'], 'required'],
            [['parent_cate', 'status', 'weight'], 'integer'],
            [['name'], 'string', 'max' => 40],
            [['res1', 'res2', 'res3'], 'string', 'max' => 80]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'name' => 'Name',
            'parent_cate' => 'Parent Cate',
            'status' => 'Status',
            'weight' => 'Weight',
            'res1' => '文章标记',
            'res2' => 'Res2',
            'res3' => 'Res3',
        ];
    }
    public function getRelationCate2()
    {
        return $this->hasOne(ArticleCate2::className(), ['id' => 'parent_cate']);
    }
}
